// pages/apply/apply.js
import urls from '../../utils/urls.js'
import loginFn from '../../utils/login.js'
var app = getApp()
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		applyList: [],
		schoolBrandId: 0, //品牌id
		schoolId: 0
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		console.log('options:',options);
		if (options.schoolId) {
			this.setData({
				schoolBrandId: options.schoolBrandId, //品牌id
				schoolId: options.schoolId
			})
		}
	},

	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow: function() {
		console.log('真的')
		console.log(app.globalData.location)
		var that = this
		var loginInfo = wx.getStorageSync('login')
		loginInfo.schoolBrandId = this.data.schoolBrandId
		loginInfo.schoolId = this.data.schoolId
		loginInfo.lat = app.globalData.location.latitude
		loginInfo.lng = app.globalData.location.longitude
		wx.request({
			url: urls.allschool,
			method: 'POST',
			data: loginInfo,
			success: function(res) {
				if (res.data.code == '0') {
					that.setData({
						applyList: res.data.data.list
					})
				}

			}

		})
	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {

	}
})
